package com.chen.gulimall.cart.config;
import com.alibaba.fastjson.JSON;
import com.chen.gulimallcommon.common.exception.ExceptionCodeEnum;
import com.chen.gulimallcommon.common.utils.R;
import org.springframework.context.annotation.Configuration;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 *
 * @author Mr.Chen
 */
//@Configuration
//public class GulimallCartSentinelConfig {
//
//    public GulimallCartSentinelConfig() {
//
//        WebCallbackManager.setUrlBlockHandler(new UrlBlockHandler() {
//            @Override
//            public void blocked(HttpServletRequest request, HttpServletResponse response, BlockException ex) throws IOException {
//                R error = R.error(ExceptionCodeEnum.TO_MANY_REQUEST.getCode(),ExceptionCodeEnum.TO_MANY_REQUEST.getMessage());
//                response.setCharacterEncoding("UTF-8");
//                response.setContentType("application/json");
//                response.getWriter().write(JSON.toJSONString(error));
//
//            }
//        });
//
//    }
//
//}
